/*
 */
package org.hook.showcase.persistence.mybatis.service;

import java.util.List;

import org.hook.showcase.persistence.mybatis.DataSourceContextHolder;
import org.hook.showcase.persistence.mybatis.mapper.ProductMapper;
import org.hook.showcase.persistence.mybatis.model.Product;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author suwuqiang 2011-7-14
 */
@Service
public class ProductService {
	@Autowired
	private ProductMapper productMapper;

	public List<Product> getProductListByCategory(String target, String categoryId) {
		DataSourceContextHolder.setDataSourceType(target);
		return productMapper.getProductListByCategory(categoryId);
	}

	public Product getProduct(String target, String productId) {
		DataSourceContextHolder.setDataSourceType(target);
		return productMapper.getProduct(productId);
	}

	public List<Product> searchProductList(String target, String keywords) {
		DataSourceContextHolder.setDataSourceType(target);
		return productMapper.searchProductList(keywords);
	}
}
